Option Strict On

Imports System
Imports System.Web.UI

Partial Class Controls_Tagging_EditTags
    Inherits UserControl

#Region "Properties"

    Private mIdentifier As Guid

    Public Property Identifier() As Guid
        Get
            Return mIdentifier
        End Get
        Set(ByVal value As Guid)
            mIdentifier = value
        End Set
    End Property

#End Region


    Public Sub GetUserTags()
        If Not Context.User.Identity.IsAuthenticated Then
            Return
        End If
        Dim tagging As New TagLib.Tagging
        Dim tags As New System.Collections.Generic.List(Of TagLib.TagItem)
        gvTaggedPages.DataSource = tagging.GetUserTags(Context.User.Identity.Name, Request.UserHostAddress)
        gvTaggedPages.DataBind()
        Me.TagCloud.DataSource = tagging.TagItemList
        Me.TagCloud.DataBind()

    End Sub


    Protected Sub gvTags_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles gvTaggedPages.RowDeleting
        ' Delete Selected Tag
        Dim Ident As Guid = New Guid(gvTaggedPages.DataKeys(e.RowIndex).Values(0).ToString)
        Dim tag As String = gvTaggedPages.DataKeys(e.RowIndex).Values(1).ToString
        TagLib.Tagging.DeleteUserDocumentTag(Context.User.Identity.Name, Ident, tag)
        Me.GetUserTags()
    End Sub




End Class
